<?php
use App\Model\Comcheck;?>
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>区域检查统计</title>
	<link rel="stylesheet" href="/css/style.css">
	<link rel="stylesheet" type="text/css" href="/css/jquerydateinput.css"/>
	<!--<script src="js/laydate.js"></script>-->
	<script src="/js/jquery.min.js"></script>
	<!--时间插件-->
	<script type="text/javascript" src="/js/jquery.date_input.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/jquery.my-modal.1.1.winStyle.css" />
	<script type="text/javascript" src="/js/jquery.my-modal.1.1.js"></script>

</head>
<body style="background: #F2F2F2;">
<form action="" method="post" enctype="multipart/form-data">
	{{ csrf_field() }}
	<div class="bx zitidaxiao">
		<ul class="ybzl">
			<li><p>选择开始日期</p><input type="text" value="" class="date_picker" name="start_date" placeholder="请输入开始日期"></li>
			<li><p>选择结束日期</p><input type="text" value="" class="date_picker" name="end_date" placeholder="请输入结束日期"></li>
			<li><p>查询区域</p>
				<select name="province" id="province" onchange="loadRegion('province',2,'city','getRegion');">
					<option value="" selected>省份/直辖市</option>
					@foreach ($province as $p)
						<option value="{{$p->id}}" >{{$p->name}}</option>
					@endforeach
				</select>
				<select name="city" id="city"  onchange="loadRegion('city',3,'town','getRegion');">
					<option value="">市/县</option>
				</select>
				<select name="town" id="town" onchange="loadRegion('town',4,'street','getRegion');">
					<option value="">镇/区</option>
				</select>
				<select name="street" id="street">
					<option value="">街道</option>
				</select>
			</li>
		</ul>
	</div>
	<input type="submit" class="qrtj dibuann" value="查询">

</form>
<script type="text/javascript">
	$(function(){

		$('.date_picker').date_input();

	})
	function loadRegion(sel,type_id,selName,url){
		$("#"+selName+" option").each(function(){
			$(this).remove();
		});
		$("<option value=0>请选择</option>").appendTo($("#"+selName));
		if($("#"+sel).val()==0){
			return;
		}
		$.getJSON(url+'/pid/'+$("#"+sel).val()+'/type/'+type_id,
				function(data){
					if(data){
						$.each(data,function(idx,item){
							$("<option value="+item.id+">"+item.name+"</option>").appendTo($("#"+selName));
						});
					}else{
						$("<option value='0'>请选择</option>").appendTo($("#"+selName));
					}
				}
		);
	}
</script>
</body>
@include('error.alerts')

</html>